package com.longcai.controller.fuyoupay;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.longcai.bean.ApiResult;
import com.longcai.entity.nearby.ClyjNearbyShops;
import com.longcai.entity.payment.fuyou.request.ClyjFuyouCompanyRegister;
import com.longcai.service.fuyoupay.ClyjFuyouCompanyRegisterService;
import com.longcai.service.fuyoupay.ClyjFuyouSubamountProportionService;

@Controller
@RequestMapping("/clyjFuyouCompanyRegister")
public class ClyjFuyouCompanyRegisterController {

    @Autowired
    private ClyjFuyouCompanyRegisterService clyjFuyouCompanyRegisterService;
    @Autowired
    private ClyjFuyouSubamountProportionService clyjFuyouSubamountProportionService;

    /**
     * 富有商家注册开户
     *
     * @param clyjNearbyShops
     * @return
     */
    @RequestMapping("/cfcruestSave")
    @ResponseBody
    public ApiResult<?> AddCompanyRegister(ClyjNearbyShops clyjNearbyShops) {

        ApiResult<ClyjFuyouCompanyRegister> cfcr = clyjFuyouCompanyRegisterService.check(clyjNearbyShops);
        if (cfcr.getData() instanceof ClyjFuyouCompanyRegister) {
            boolean b = clyjFuyouCompanyRegisterService.insert(cfcr.getData());
            if (b) {
                return ApiResult.success("注册成功");
            }
        }

        return ApiResult.fail("注册失败");
    }

}
